package com.ag.common.config.webmvc;


import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;


@Configuration
//@Component("common-webconfig")
public class WebMvcConfig extends WebMvcConfigurerAdapter {


    @Bean
    public  CorsInterceptor corsInterceptor() {
        CorsInterceptor corsInterceptor = new  CorsInterceptor();

        return corsInterceptor;
    }
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(corsInterceptor()).addPathPatterns("/**");;

    }

}
